<html>
<head><meta charset="utf-8"><title>building rust/cargo from source for cross_compile mips64_... · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html">building rust/cargo from source for cross_compile mips64_...</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212203331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203331">(Oct 04 2020 at 03:28)</a>:</h4>
<p>I'm attempting to compile from source.  I'm receiving the following error:</p>
<div class="codehilite"><pre><span></span><code>   Compiling rustc_traits v0.0.0 (/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/compiler/rustc_traits)
   Compiling rustc_passes v0.0.0 (/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/compiler/rustc_passes)
malloc(): invalid size (unsorted)
rustc exited with signal: 6
error: could not compile `rustc_traits`.

Caused by:
  process didn&#39;t exit successfully: `/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/bootstrap/debug/rustc --crate-name rustc_traits --edition=2018 compiler/rustc_traits/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -Cembed-bitcode=no -C debuginfo=1 -C debug-assertions=on -C overflow-checks=off -C metadata=5869810c7d227a39 -C extra-filename=-5869810c7d227a39 --out-dir /home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps --extern chalk_engine=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_engine-a8d5d9397c7719be.rmeta --extern chalk_ir=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_ir-d0a0105e29c12f02.rmeta --extern chalk_solve=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libchalk_solve-521f7cb05860b7fb.rmeta --extern rustc_ast=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_ast-9663c5f9390c1d5a.rmeta --extern rustc_data_structures=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-44f30f5c78c04bad.rmeta --extern rustc_hir=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_hir-ea01d6dafe1c3edf.rmeta --extern rustc_index=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_index-6cef9c51b92199a4.rmeta --extern rustc_infer=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_infer-b9b262356d7f7e36.rmeta --extern rustc_middle=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_middle-b41c2d1c90aa8880.rmeta --extern rustc_span=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_span-2aad16fdfd498cfb.rmeta --extern rustc_trait_selection=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_trait_selection-fb1bd8c37b3946f2.rmeta --extern smallvec=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libsmallvec-3e4c748bf3501be8.rmeta --extern tracing=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/libtracing-e66a7d368ca0f2bf.rmeta -Zmacro-backtrace &#39;-Clink-args=-Wl,-rpath,$ORIGIN/../lib&#39; -Zunstable-options &#39;-Wrustc::internal&#39; -Cprefer-dynamic -Zbinary-dep-depinfo -L native=/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/psm-4f2793ec4c7532ef/out` (exit code: 254)
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: &quot;/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu/stage0/bin/cargo&quot; &quot;build&quot; &quot;--target&quot; &quot;x86_64-unknown-linux-gnu&quot; &quot;-Zbinary-dep-depinfo&quot; &quot;-j&quot; &quot;8&quot; &quot;--release&quot; &quot;--features&quot; &quot; llvm&quot; &quot;--manifest-path&quot; &quot;/home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/compiler/rustc/Cargo.toml&quot; &quot;--message-format&quot; &quot;json-render-diagnostics&quot;
expected success, got: exit code: 101
failed to run: /home/grommish/openwrt/build_dir/hostpkg/rust-1.22.1/build/bootstrap/debug/bootstrap build --stage 2
Build completed unsuccessfully in 1:37:40
make[3]: *** [Makefile:12: all] Error 1
</code></pre></div>


<p>I'm building via ./configure and passing the following args to it:</p>
<div class="codehilite"><pre><span></span><code>CONFIGURE_ARGS= \
     --build=x86_64-unknown-linux-gnu \
     --target=mips64-unknown-linux-muslabi64 \
     --disable-docs \
     --disable-compiler-docs \
     --prefix=$(CONFIGURE_PREFIX) \
     --bindir=$(CONFIGURE_PREFIX)/bin \
     --libdir=$(CONFIGURE_PREFIX)/lib \
     --sysconfdir=/etc \
     --datadir=$(CONFIGURE_PREFIX)/share \
     --localstatedir=/var \
     --mandir=$(CONFIGURE_PREFIX)/man \
     --infodir=$(CONFIGURE_PREFIX)/info \
     --enable-debug \
     --enable-full-tools \
     --musl-root-mips64=$(TOOLCHAIN_DIR) \
     --set=target.mips64-unknown-linux-muslabi64.musl-root=$(TOOLCHAIN_DIR) \
     --set=target.mips64-unknown-linux-muslabi64.linker=$(LD) \
     --release-channel=experimental
</code></pre></div>


<p>Suggestions?  I'm needing to get it compiled so I can create custom soft-float/dynamically linked chains, but I can't even get it to build out what <em>should</em> work :D</p>



<a name="212203352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203352">(Oct 04 2020 at 03:29)</a>:</h4>
<p>are you on x32? you might have exhausted the address space</p>



<a name="212203357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203357">(Oct 04 2020 at 03:29)</a>:</h4>
<p>although I'd expect that to be in rustc_middle, not rustc_traits</p>



<a name="212203400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203400">(Oct 04 2020 at 03:30)</a>:</h4>
<p>oh hold on - does <code>--enable-debug</code> turn on debuginfo=2? that might be it too, that generates a <em>ton</em> of data</p>



<a name="212203408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203408">(Oct 04 2020 at 03:30)</a>:</h4>
<p>you could also try <code>-j1</code> to see if that uses less memory</p>



<a name="212203527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203527">(Oct 04 2020 at 03:34)</a>:</h4>
<p>I call via -j1, but the configure script apparently overrides it with $(nproc). (the CMake build system I guess)   The build system is an i7 4c/8t with 28gb Ram.  I'm not even stressing the build</p>
<div class="codehilite"><pre><span></span><code>              total        used        free      shared  buff/cache   available
Mem:       28705120     9176920     8605112      983180    10923088    18120920
Swap:       2097148       37632     2059516
</code></pre></div>


<p>I can certainly try to remove --enable-debug and try again.  I will log out the entire build if you want, I'm not sure how large it'll be before tgz'ing though.</p>



<a name="212203668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203668">(Oct 04 2020 at 03:39)</a>:</h4>
<p>hmm that seems like it should have more than enough mem</p>



<a name="212203673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203673">(Oct 04 2020 at 03:39)</a>:</h4>
<p>I never heard - are you on x32?</p>



<a name="212203781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203781">(Oct 04 2020 at 03:42)</a>:</h4>
<p>x64 on host and 64bit BE target (x64/mips64 build/target)</p>



<a name="212203841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203841">(Oct 04 2020 at 03:44)</a>:</h4>
<blockquote>
<p>rust-1.22.1</p>
</blockquote>
<p>any reason you're using such an old version?</p>



<a name="212203846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203846">(Oct 04 2020 at 03:44)</a>:</h4>
<p>I'm cloning from source, main branch, commit <a href="https://github.com/rust-lang/rust/commit/fc2daaae610b5515438b551a2f3706196a997f35">fc2daaae610b5515438b551a2f3706196a997f35</a></p>



<a name="212203854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203854">(Oct 04 2020 at 03:45)</a>:</h4>
<p>ah ok, the build directory is just named weird then</p>



<a name="212203859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203859">(Oct 04 2020 at 03:45)</a>:</h4>
<p>not sure what's going wrong, sorry</p>



<a name="212203904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203904">(Oct 04 2020 at 03:46)</a>:</h4>
<p>I'm working to incorporate Rust/Cargo into OpenWrt, which complicated things, but I'll try removing the debugging calls.  </p>
<p>Thanks! :)</p>



<a name="212203992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212203992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212203992">(Oct 04 2020 at 03:49)</a>:</h4>
<p>all mips targets in compilers are hard-float</p>



<a name="212204092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212204092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212204092">(Oct 04 2020 at 03:52)</a>:</h4>
<p>Yes, the are also -static, which is not helpful.. But that's why I'm trying to build from source, so I can define my own targets.</p>
<p>I've defined a mips64-muslabi64sf target once I actually get the system working, for now, I'm just trying to get the built-in targets to build and then worry about custom targets</p>



<a name="212204954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212204954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212204954">(Oct 04 2020 at 04:20)</a>:</h4>
<p>how did you get the C cross-compiler ? Is it from debian package ?</p>



<a name="212205256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212205256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212205256">(Oct 04 2020 at 04:30)</a>:</h4>
<p>I'm using the OpenWrt musl toolchain, though I updated it to 1.2.1 and gcc 10.2</p>



<a name="212205491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212205491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212205491">(Oct 04 2020 at 04:39)</a>:</h4>
<p>thanks. I'm trying building with Codescape GNU Tools, for  mips64-unknown-linux-gnuabi64</p>



<a name="212205602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212205602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212205602">(Oct 04 2020 at 04:42)</a>:</h4>
<p>Ah.  I'm trying muslabi64.  I ran into the static linking issue and seemed to have corrected that (I added a -DLLVM_LINK_LLVM_DYLIB:ON CMake flag).. and the soft-float I can fix with the custom .rs file, assuming I can get it to actually build out.</p>



<a name="212216810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212216810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212216810">(Oct 04 2020 at 10:27)</a>:</h4>
<p>I finished getting it to compile.  Now, if I'm correct, I need to use the build/x86_64-unknown-linux-gnu/bin/stage2/bin/rustc to <em>cross</em> compile my target (mips64-musl) package (Suricata) and not the stage0/stage1 rustc?  But I'll use the stage0 cargo bin?</p>
<p>I'm using --build and --target, but not --host.  Would --host make the mips64 stage2 files?</p>
<div class="codehilite"><pre><span></span><code>grommish@norwits:~/openwrt/build_dir/hostpkg/rust-1.22.1/build/x86_64-unknown-linux-gnu$ ls
llvm  stage0  stage0-std  stage0-sysroot  stage1  stage2
</code></pre></div>



<a name="212222042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212222042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212222042">(Oct 04 2020 at 12:50)</a>:</h4>
<p>This has changed lot recently but I <em>think</em> the current situation is HOST is built by default</p>



<a name="212222055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212222055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212222055">(Oct 04 2020 at 12:51)</a>:</h4>
<p>Search <code>A-rustbuild</code> on GitHub and some stuff should pop up</p>



<a name="212229819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212229819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212229819">(Oct 04 2020 at 16:22)</a>:</h4>
<p>Ok.. thank you <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> and <span class="user-mention" data-user-id="209117">@lzutao</span> .   Remember, I'm not using <code>x.py</code> at all for this.  I'll continue to play around with it.</p>



<a name="212229980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212229980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212229980">(Oct 04 2020 at 16:27)</a>:</h4>
<p>Configure and make just call x.py internally</p>



<a name="212230026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212230026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212230026">(Oct 04 2020 at 16:28)</a>:</h4>
<p>They're only there to make the interface more friendly</p>



<a name="212233066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212233066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212233066">(Oct 04 2020 at 17:45)</a>:</h4>
<div class="codehilite"><pre><span></span><code>Copying stage2 std from stage2 (x86_64-unknown-linux-gnu -&gt; x86_64-unknown-linux-gnu / mips64-unknown-linux-muslabi64)
Build completed successfully in 0:42:53
</code></pre></div>


<p>From what I've read, stage2 should be what I'm looking for..  :)  I think I'm finally getting somewhere.</p>



<a name="212382046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382046">(Oct 06 2020 at 03:50)</a>:</h4>
<p>I'm missing some fundamental understandings here, so bear with me.</p>
<p>The situation is, I'm building rust into OpenWrt.  I'm building rustc for the host triple to use to (usually) cross compile to a second toolchain: <code>x86_64-unknown-linux-gnu</code> for the host, <code>mips64-unknown-linux-muslabi64</code> for the eventual cross-compile target.</p>
<p>Now, I am only needing to cross-compile for the target, not create rustc/cargo for installation on the target.  It's only being used to cross-compile on the host for target.</p>
<p>I've gotten rustc to compile, which generates ./build/x86_64-unknown-linux-gnu directories:</p>
<div class="codehilite"><pre><span></span><code>lld  llvm  stage0  stage0-rustc  stage0-std  stage0-sysroot
stage1  stage1-rustc  stage1-std  stage2  stage2-std
</code></pre></div>


<p><code>stage0</code> has all of the rustc and cargo bins, <code>stage1</code> and <code>stage2</code> only contain rustc.</p>
<p>Can anyone tell me what I need to point the OpenWrt build system to?  Stage2?  Stage0? Neither?  <br>
These are my <code>configure</code> arguments, and the stage2 seems to be the one for the target, but it's only rustc.</p>
<div class="codehilite"><pre><span></span><code>     --build=x86_64-unknown-linux-gnu \
     --target=mips64-unknown-linux-muslabi64 \
     --enable-llvm-link-shared \
     --enable-ccache \
     --disable-docs \
     --disable-compiler-docs \
     --prefix=$(CONFIGURE_PREFIX) \
     --bindir=$(CONFIGURE_PREFIX)/bin \
     --libdir=$(CONFIGURE_PREFIX)/lib \
     --sysconfdir=/etc \
     --datadir=$(CONFIGURE_PREFIX)/share \
     --localstatedir=/var \
     --mandir=$(CONFIGURE_PREFIX)/man \
     --infodir=$(CONFIGURE_PREFIX)/info \
     --enable-full-tools \
     --musl-root-mips64=$(TOOLCHAIN_DIR) \
     --set=target.mips64-unknown-linux-muslabi64.musl-root=$(TOOLCHAIN_DIR) \
     --set=target.mips64-unknown-linux-muslabi64.linker=$(LD) \
     --release-channel=experimental
</code></pre></div>



<a name="212382259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382259">(Oct 06 2020 at 03:55)</a>:</h4>
<p>I think you need <code>--extended</code> to get tools</p>



<a name="212382324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382324">(Oct 06 2020 at 03:56)</a>:</h4>
<blockquote>
<p>Now, I am only needing to cross-compile for the target, not create rustc/cargo for installation on the target. It's only being used to cross-compile on the host for target.</p>
</blockquote>
<p>wait, you mean you only need rustc on the host, then want to cross compile some other program using that host rustc?</p>



<a name="212382329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382329">(Oct 06 2020 at 03:56)</a>:</h4>
<p>then either stage1 or stage 2 would work</p>



<a name="212382334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382334">(Oct 06 2020 at 03:56)</a>:</h4>
<p>and the toolchain will be in <code>build/$HOST/stageN</code></p>



<a name="212382634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382634">(Oct 06 2020 at 04:02)</a>:</h4>
<p>I'm building out now to test.  I have such confidence I'm going to ask another question :D  I will eventually need to use a custom target to support soft-float.  I've created the .rs json file.  Do I just drop it into <code>./compiler/rustc_target/src/spec/</code> and call it as the <code>--target</code> as normal?  I'm already calling the experimental channell</p>



<a name="212382653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382653">(Oct 06 2020 at 04:03)</a>:</h4>
<p>I'm not sure, maybe take a look at <a href="https://github.com/rust-lang/rust/pull/74541/">https://github.com/rust-lang/rust/pull/74541/</a></p>



<a name="212382769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212382769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212382769">(Oct 06 2020 at 04:05)</a>:</h4>
<p>Thanks.. Looks like it!  I'm just using the standard <code>mips64_unknown_linux_muslabi64</code> and just adding a <code>soft-float</code> to it..  Nothing else needs to be changed.  Hoepfully I'll be able to report a success :)  Thanks again!</p>



<a name="212389017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212389017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212389017">(Oct 06 2020 at 06:27)</a>:</h4>
<p>Well.. I added the <code>--enable-extended</code> and <code>--enable-manage-submodules</code> and <code>stage2</code> still only contains <code>rustc</code> and the accompanying lib files. (<code>stage1</code> also only contains <code>rustc</code>)</p>
<p>Any ideas on how to get the other things like <code>cargo</code> to build in <code>stage2</code>?</p>



<a name="212389328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212389328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212389328">(Oct 06 2020 at 06:32)</a>:</h4>
<p>They are built, but placed in <code>stageN-tools</code> iirc</p>



<a name="212389542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212389542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212389542">(Oct 06 2020 at 06:37)</a>:</h4>
<p>These are the only directories that are created..<br>
<code>lld  llvm  stage0  stage0-rustc  stage0-std  stage0-sysroot  stage1  stage1-rustc  stage1-std  stage2  stage2-std</code></p>
<p>See my above ./configure args.. Did I miss one?</p>
<p>The <code>stage0/bin</code> directory has all the good stuff, but from what I  understand, it isn't what I need.</p>
<p><code>cargo  cargo-fmt  rustc  rustdoc  rustfmt  rust-gdb  rust-gdbgui  rust-lldb</code></p>



<a name="212460259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212460259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Greaves <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212460259">(Oct 06 2020 at 17:36)</a>:</h4>
<p>This page <a href="https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html">https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html</a><br>
documents various build targets such as : ./x.py build -i library/std<br>
(there's a lot of stuff out there so you may not have seen it - or like me, just skimmed it first time through :) )</p>



<a name="212462451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212462451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212462451">(Oct 06 2020 at 17:55)</a>:</h4>
<p>if you're doing complicated things I highly recommend readidng through <a href="https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html">https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html</a></p>



<a name="212475822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212475822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212475822">(Oct 06 2020 at 19:47)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  The bootstrapping page is where I got the info about needing Stage2 for the cross-compile.  I still think I'm missing a <code>--arg</code> somewhere.</p>
<p><span class="user-mention" data-user-id="348444">@David Greaves</span> One of the issues I'm facing is that I can't called <code>x.py</code> directly, I use the <code>./configure</code> wrapper.  I'm just going to have to go turn everything on and see what breaks, I suppose :)</p>



<a name="212476248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212476248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212476248">(Oct 06 2020 at 19:51)</a>:</h4>
<p>configure and then running x.py is expected/supported</p>



<a name="212476252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212476252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212476252">(Oct 06 2020 at 19:51)</a>:</h4>
<p>fwiw</p>



<a name="212477516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212477516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212477516">(Oct 06 2020 at 20:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> Yes, but I'm calling it via <code>./configure</code> and then <code>make</code>.  I do not invoke <code>x.py</code> at all directly because it's in a fakeroot build system besides whatever the Makefile calls.  If there is a better way, I'm all for trying, but x.py failed for me because it expects to be installed on the host directly (<code>/usr, /bin, etc</code>), which isn't what I'm trying to do.</p>



<a name="212477645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212477645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212477645">(Oct 06 2020 at 20:01)</a>:</h4>
<p>Make directly runs x.py, so I fail to see why you would not be able to do the same.</p>



<a name="212477782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212477782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212477782">(Oct 06 2020 at 20:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> Right :) I just edit'ed that to include Makefile is a wrapper</p>
<p>So, the question remains, if ./configure is acceptable, and Makefile just called x.py, why am I not seeing the full Stage1/2 artifacts?</p>



<a name="212477851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212477851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212477851">(Oct 06 2020 at 20:03)</a>:</h4>
<p>I still don't follow what the problem is</p>



<a name="212477917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212477917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212477917">(Oct 06 2020 at 20:03)</a>:</h4>
<p>if you're pulling artifacts out of the rust build system, I strongly recommend using x.py dist (or make dist)</p>



<a name="212478082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212478082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212478082">(Oct 06 2020 at 20:04)</a>:</h4>
<p>cross-compilation with x.py build is unlikely to do what you want, it is semi-broken right now, see <a href="https://github.com/rust-lang/rust/issues/77352">https://github.com/rust-lang/rust/issues/77352</a></p>



<a name="212478124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212478124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212478124">(Oct 06 2020 at 20:05)</a>:</h4>
<p>(and x.py install if you want to immediately use those artifacts, it will internally build what is needed)</p>



<a name="212478448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212478448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212478448">(Oct 06 2020 at 20:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span>  I'll give a go :) Thanks!</p>



<a name="212723277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212723277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212723277">(Oct 08 2020 at 17:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> I took heed of the comments in that issue you linked.  I did do the <code>x.py dist library/std src/librustc</code> and it built out <code>rust-analysis-1.48.0-dev-mips64-unknown-linux-muslabi64sf.tar.gz/xz</code> and <code>rust-std-1.48.0-dev-mips64-unknown-linux-muslabi64sf.tar.gz/xz</code> files.  These tarballs only contain the rustlib files, but no binaries.  Did I (again) miss something?</p>



<a name="212728412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212728412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212728412">(Oct 08 2020 at 18:06)</a>:</h4>
<p>That seems like too small a set - what is your host/target config?</p>



<a name="212739851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212739851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212739851">(Oct 08 2020 at 19:41)</a>:</h4>
<p><code>x86_64-unknown-linux-gnu / mips64-unknown-linux-muslabi64sf</code> host/target.</p>
<p>My full ./configure arg-list<br>
<code>
CONFIGURE_ARGS= \
     --build=$(RUSTC_HOST_ARCH) \
     --target=$(RUSTC_TARGET_ARCH) \
     --enable-full-tools \
     --enable-full-bootstrap \
     --enable-llvm-link-shared \
     --enable-extended \
     --enable-manage-submodules \
     --enable-ccache \
     --disable-docs \
     --disable-compiler-docs \
     --prefix=$(CONFIGURE_PREFIX) \
     --bindir=$(CONFIGURE_PREFIX)/bin \
     --libdir=$(CONFIGURE_PREFIX)/lib \
     --sysconfdir=$(CONFIGURE_PREFIX)/etc \
     --datadir=$(CONFIGURE_PREFIX)/share \
     --localstatedir=/var \
     --mandir=$(CONFIGURE_PREFIX)/man \
     --infodir=$(CONFIGURE_PREFIX)/info \
     --set=target.mips64-unknown-linux-muslabi64sf.musl-root=$(TOOLCHAIN_DIR) \
     --set=target.mips64-unknown-linux-muslabi64sf.linker=$(LD) \
     --release-channel=experimental
</code></p>



<a name="212740464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212740464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212740464">(Oct 08 2020 at 19:47)</a>:</h4>
<p>I've defined the target in the correct places, i believe.  I dropped the .rs file in <code>./compiler/rustc_target/src/spec/</code> and added the entry in <code>mod.rs</code></p>
<p>This is my .rs file.</p>
<div class="codehilite"><pre><span></span><code>use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};

pub fn target() -&gt; TargetResult {
    let mut base = super::linux_musl_base::opts();
    base.cpu = &quot;mips64r2&quot;.to_string();
    base.features = &quot;+mips64r2,+soft-float&quot;.to_string();
    base.max_atomic_width = Some(64);
    Ok(Target {
        // LLVM doesn&#39;t recognize &quot;muslabi64&quot; yet.
        llvm_target: &quot;mips64-unknown-linux-musl&quot;.to_string(),
        target_endian: &quot;big&quot;.to_string(),
        target_pointer_width: &quot;64&quot;.to_string(),
        target_c_int_width: &quot;32&quot;.to_string(),
        data_layout: &quot;E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128&quot;.to_string(),
        arch: &quot;mips64&quot;.to_string(),
        target_os: &quot;linux&quot;.to_string(),
        target_env: &quot;musl&quot;.to_string(),
        target_vendor: &quot;unknown&quot;.to_string(),
        linker_flavor: LinkerFlavor::Gcc,
        options: TargetOptions { target_mcount: &quot;_mcount&quot;.to_string(), ..base },
    })
}
</code></pre></div>



<a name="212741046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212741046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212741046">(Oct 08 2020 at 19:52)</a>:</h4>
<p>You want --host=$(RUSTC_TARGET_ARCH), I suspect</p>



<a name="212741054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212741054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212741054">(Oct 08 2020 at 19:53)</a>:</h4>
<p>in addition</p>



<a name="212741259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212741259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212741259">(Oct 08 2020 at 19:54)</a>:</h4>
<p><em>edit</em> So.. I learned to read :D  I forgot I moved --host off after reading the documentation.</p>
<p>Should I make --host the target (mips64-muslabi64sf) or the host x86_64-gnu?  Since I only really need the ability to cross-compile.</p>



<a name="212742956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212742956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212742956">(Oct 08 2020 at 20:09)</a>:</h4>
<p>I don't know what you mean by "ability to cross-compile"</p>



<a name="212743019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212743019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212743019">(Oct 08 2020 at 20:10)</a>:</h4>
<p>host should be a list of triples on which you intend to run rustc itself</p>



<a name="212743290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212743290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212743290">(Oct 08 2020 at 20:12)</a>:</h4>
<p>I'm building this into OpenWrt.  The host, in this case, is the x86_64-linux-gnu.  The target in which the other packages (Suricata, in this instance) will be compiled to is the mips64_sf.  I do not need to run rustc/cargo on the mips64 device itself, although I wouldn't turn down the ability to do so.  The primary goal is to generate a toolchain that will compile for the mips64-sf target on the x86_64-gnu machine.</p>
<p>Everything works, so far.. I generate out the stage0/stage1/stage2 directories, mostly.  but, as you pointed out earlier, it's broken that way.</p>



<a name="212996611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996611">(Oct 12 2020 at 04:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> , I know you're just going to facepalm, and I apologize ;p  But....</p>
<p>So I decided to take OpenWrt out of the equation, so I can see what needs to be done just to get it done, then I'll worry about incorporating.  I'm using the args, but not using the OpenWrt build environment.</p>
<p>Using your suggestion, I build out <code>python3 x.py dist library/std src/librustc</code> and it worked fine (woot!), using</p>
<div class="codehilite"><pre><span></span><code>./configure --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=mips64-unknown-linux-muslabi64sf --enable-full-tools --enable-full-bootstrap --enable-llvm-link-shared --enable-extended --enable-manage-submodules --enable-ccache --disable-docs --disable-compiler-docs --prefix=/home/grommish/openwrt/build_dir/hostpkg/.cargo --bindir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin --libdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib \
--sysconfdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/etc --datadir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/share --localstatedir=/var --mandir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/man --infodir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/info --set=target.mips64-unknown-linux-muslabi64sf.musl-root=/home/grommish/openwrt/staging_dir/toolchain-mips64_octeon3_64_gcc-10.2.0_musl --release-channel=experimental
</code></pre></div>


<p>to set everything up.</p>
<p>If I attempt to install it <code>python3 x.py install</code>, I get the below error.</p>
<div class="codehilite"><pre><span></span><code>   Compiling rls-rustc v0.6.0 (/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/src/tools/rls/rls-rustc)
error[E0061]: this function takes 5 arguments but 4 arguments were supplied
  --&gt; src/tools/rls/rls-rustc/src/lib.rs:78:41
   |
78 |     rustc_driver::catch_fatal_errors(|| run_compiler(&amp;args, &amp;mut shim_calls, file_loader, None))
   |                                         ^^^^^^^^^^^^ -----  ---------------  -----------  ---- supplied 4 arguments
   |                                         |
   |                                         expected 5 arguments

error: aborting due to previous error

For more information about this error, try `rustc --explain E0061`.

Did not run successfully: exit code: 1
&quot;/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2/bin/rustc&quot; &quot;--crate-name&quot; &quot;rls_rustc&quot; &quot;--edition=2018&quot; &quot;src/tools/rls/rls-rustc/src/lib.rs&quot; &quot;--error-format=json&quot; &quot;--json=diagnostic-rendered-ansi,artifacts&quot; &quot;--crate-type&quot; &quot;lib&quot; &quot;--emit=dep-info,metadata,link&quot; &quot;-C&quot; &quot;opt-level=3&quot; &quot;-Cembed-bitcode=no&quot; &quot;-C&quot; &quot;debuginfo=0&quot; &quot;--cfg&quot; &quot;feature=\&quot;clippy\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;clippy_lints\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;default\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;futures\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;ipc\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;rls-data\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;rls-ipc\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;serde\&quot;&quot; &quot;--cfg&quot; &quot;feature=\&quot;tokio\&quot;&quot; &quot;-C&quot; &quot;metadata=7f78e115ed0d77c7&quot; &quot;-C&quot; &quot;extra-filename=-7f78e115ed0d77c7&quot; &quot;--out-dir&quot; &quot;/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps&quot; &quot;--target&quot; &quot;x86_64-unknown-linux-gnu&quot; &quot;-L&quot; &quot;dependency=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps&quot; &quot;-L&quot; &quot;dependency=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps&quot; &quot;--extern&quot; &quot;clippy_lints=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-eefac17fd52698cb.rmeta&quot; &quot;--extern&quot; &quot;env_logger=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libenv_logger-35a553754168ae5c.rmeta&quot; &quot;--extern&quot; &quot;futures=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-402185e6482d9e40.rmeta&quot; &quot;--extern&quot; &quot;log=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/liblog-a566e02018ff4668.rmeta&quot; &quot;--extern&quot; &quot;rand=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librand-a413504ed756456c.rmeta&quot; &quot;--extern&quot; &quot;rls_data=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librls_data-d6026e59f03e8e9e.rmeta&quot; &quot;--extern&quot; &quot;rls_ipc=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/librls_ipc-7e9f2706b64e4644.rmeta&quot; &quot;--extern&quot; &quot;serde=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libserde-fa91955d658a291d.rmeta&quot; &quot;--extern&quot; &quot;tokio=/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-25a6eb5c5a448ef4.rmeta&quot; &quot;-Zmacro-backtrace&quot; &quot;-Clink-args=-Wl,-rpath,$ORIGIN/../lib&quot; &quot;-Zbinary-dep-depinfo&quot; &quot;--sysroot&quot; &quot;/home/grommish/openwrt/build_dir/hostpkg/rust-1.46.0/build/x86_64-unknown-linux-gnu/stage2&quot;
-------------
error: could not compile `rls-rustc`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
</code></pre></div>



<a name="212996619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996619">(Oct 12 2020 at 04:21)</a>:</h4>
<p>RLS is broken right now: <a href="https://github.com/rust-lang/rust/issues/77810">https://github.com/rust-lang/rust/issues/77810</a></p>



<a name="212996658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996658">(Oct 12 2020 at 04:22)</a>:</h4>
<p>I'd skip it for now, or pin a nightly version</p>



<a name="212996732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996732">(Oct 12 2020 at 04:24)</a>:</h4>
<p>Silly question, how do I exclude the package :D  It's amazing I get anything done, I know, but I promise the answers will be remembered for next time!</p>



<a name="212996738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996738">(Oct 12 2020 at 04:24)</a>:</h4>
<p>don't pass <code>--enable-full-tools</code> I think</p>



<a name="212996801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/212996801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#212996801">(Oct 12 2020 at 04:26)</a>:</h4>
<p>Oh fantastic, I will give that a try.  Thank you <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> !</p>



<a name="213010214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213010214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213010214">(Oct 12 2020 at 08:25)</a>:</h4>
<p>FYI <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> , You can also pass <code>--enable-missing-tools</code> to ignore bad packages.</p>
<p>Also, it seem the <code>rls-rust</code> isn't the only one having the issue, I am getting the same error for <code>miri</code></p>
<p>But, it builds.. It installs where I need it..  Now, all I have to do is get it to work  inside the OpenWrt build system.</p>



<a name="213061972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213061972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213061972">(Oct 12 2020 at 16:50)</a>:</h4>
<p>Reading <a href="https://github.com/rust-lang/rust/issues/77352">https://github.com/rust-lang/rust/issues/77352</a> that <span class="user-mention" data-user-id="116122">@simulacrum</span> mentioned, I am calling<br>
<code>$(PYTHON) x.py install --build=$(RUSTC_HOST_ARCH) --host=$(RUSTC_HOST_ARCH) --target=$(RUSTC_TARGET_ARCH)</code></p>
<p>and it builds, installs to my CARGO_HOME directory, containing the bin/etc/lib/man/share directories..  When i attempt a <code>cargo install --force cbindgen</code> and it gives me the error mentioned. </p>
<div class="codehilite"><pre><span></span><code>error[E0463]: can&#39;t find crate for `std`
For more information about this error, try `rustc --explain E0463`.
</code></pre></div>


<p>Do you still recommend creating a <code>dist</code> and then trying to run install on that tarball?  Or will the situation be fixed/has been fixed since the PR mentioned in the issue was merged 20 days ago?</p>



<a name="213062013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062013">(Oct 12 2020 at 16:50)</a>:</h4>
<p>Hm, I forget if I fixed that. Let me check.</p>



<a name="213062152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062152">(Oct 12 2020 at 16:52)</a>:</h4>
<p>are you on latest master?</p>



<a name="213062242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062242">(Oct 12 2020 at 16:53)</a>:</h4>
<p>Building from <code>c71248b70870960af9993de4f31d3cba9bbce7e8</code> on master, yes</p>



<a name="213062272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062272">(Oct 12 2020 at 16:53)</a>:</h4>
<p>hm, do you have a x.py install log handy?</p>



<a name="213062460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062460">(Oct 12 2020 at 16:55)</a>:</h4>
<p>it should have worked, so there must be a bug</p>



<a name="213062467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213062467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213062467">(Oct 12 2020 at 16:55)</a>:</h4>
<p>I did fix what I was thinking about earlier</p>



<a name="213064388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213064388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213064388">(Oct 12 2020 at 17:15)</a>:</h4>
<p>Give me a bit and I can create one.  I've got to step away and will be able in a few hours.  I'll let the build run while I'm away.</p>



<a name="213087360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213087360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213087360">(Oct 12 2020 at 21:16)</a>:</h4>
<p><a href="/user_uploads/4715/qQlcIuGRIXKalAHfGVmq0aKf/rust-build.log">rust-build.log</a> <br>
<a href="user_uploads/4715/vgWsuhajNhGC9HhpH45Pc6zh/cargoerr.log">cargoerr.log</a> <br>
Here's the build log.   The error occurs when I go to compile Suricata for the mips64-muslabi64sf target and I call the <code>cargo install --force cbindgen</code> prior to compiling.</p>



<a name="213377862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/213377862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#213377862">(Oct 15 2020 at 03:49)</a>:</h4>
<p>I sync'ed and build from <a href="https://github.com/rust-lang/rust/commit/5565241f65cf402c3dbcb55dd492f172c473d4ce">5565241f65cf402c3dbcb55dd492f172c473d4ce</a> today, and still receiving the error below.  Anything I can do to help?</p>
<div class="codehilite"><pre><span></span><code>cargo install --force cbindgen
    Updating crates.io index
  Installing cbindgen v0.15.0
   Compiling proc-macro2 v1.0.24
   Compiling libc v0.2.79
   Compiling syn v1.0.44
   Compiling unicode-xid v0.2.1
   Compiling cfg-if v0.1.10
   Compiling getrandom v0.1.15
   Compiling serde_derive v1.0.116
   Compiling serde v1.0.116
   Compiling ryu v1.0.5
   Compiling autocfg v1.0.1
   Compiling bitflags v1.2.1
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
   Compiling ppv-lite86 v0.2.9
error: could not compile `libc`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: failed to compile `cbindgen v0.15.0`, intermediate artifacts can be found at `/home/grommish/openwrt/tmp/cargo-installrKFrAu`

Caused by:
  build failed
</code></pre></div>



<a name="215363011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363011">(Nov 02 2020 at 19:03)</a>:</h4>
<p>So I built from HEAD <a href="https://github.com/rust-lang/rust/commit/b2025326088b54fb3f083bebeba14e0a15bf00d3">b2025326088b54fb3f083bebeba14e0a15bf00d3</a> , defined the custom target, and it compiles.. It errors on tools <code>rustfmt</code> and <code>rls</code>, but from what I understand, it doesn't really matter.</p>
<p>I'm still getting the error on cbindgen.  I've defined and compiled for the host (x86_64) and target (mips64) and it installs, but..  </p>
<p>Any suggestions?</p>
<div class="codehilite"><pre><span></span><code>grommish@norwits:~/openwrt$ which cargo
/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin/cargo
grommish@norwits:~/openwrt$ cargo install cbindgen
    Updating crates.io index
  Downloaded cbindgen v0.15.0
  Downloaded 1 crate (181.8 KB) in 1.31s
  Installing cbindgen v0.15.0
  Downloaded hashbrown v0.9.1
  Downloaded ppv-lite86 v0.2.10
  Downloaded serde_derive v1.0.117
  Downloaded serde v1.0.117
  Downloaded syn v1.0.48
  Downloaded getrandom v0.1.15
  Downloaded proc-macro2 v1.0.24
  Downloaded libc v0.2.80
  Downloaded 8 crates (1025.6 KB) in 0.37s
   Compiling proc-macro2 v1.0.24
   Compiling libc v0.2.80
   Compiling syn v1.0.48
   Compiling unicode-xid v0.2.1
   Compiling cfg-if v0.1.10
   Compiling getrandom v0.1.15
   Compiling serde_derive v1.0.117
   Compiling serde v1.0.117
   Compiling autocfg v1.0.1
   Compiling ppv-lite86 v0.2.10
   Compiling bitflags v1.2.1
error[E0463]: can&#39;t find crate for `std`

error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
   Compiling ryu v1.0.5
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `syn`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can&#39;t find crate for `core`

error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: failed to compile `cbindgen v0.15.0`, intermediate artifacts can be found at `/tmp/cargo-installBR8NkM`

Caused by:
  build failed
</code></pre></div>



<a name="215363075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363075">(Nov 02 2020 at 19:03)</a>:</h4>
<p><span class="user-mention" data-user-id="332271">@Grommish</span> how did you install cargo? and how did you install rust from source?</p>



<a name="215363097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363097">(Nov 02 2020 at 19:03)</a>:</h4>
<p>that looks like you built rustc but not the standard library</p>



<a name="215363282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363282">(Nov 02 2020 at 19:05)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    cd $(HOST_BUILD_DIR) &amp;&amp; RUST_BACKTRACE=1 $(PYTHON) x.py dist library/std src/librustc

    cd $(HOST_BUILD_DIR) &amp;&amp; RUST_BACKTRACE=1 $(PYTHON) x.py install \
     --build=$(RUSTC_HOST_ARCH) \
     --host=$(RUSTC_HOST_ARCH) \
     --target=$(RUSTC_TARGET_ARCH)
</code></pre></div>
<p>In this case,<code>x86_64-unknown-linux-gnu</code> is the host, <code>mips64-unknown-linux-muslabi64sf</code> is the custom target</p>



<a name="215363418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363418">(Nov 02 2020 at 19:06)</a>:</h4>
<p>hmm I wouldn't expect you to need <code>library/std</code> filters</p>



<a name="215363443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363443">(Nov 02 2020 at 19:06)</a>:</h4>
<p>if you run <code>x.py dist</code> without arguments does it build more? Or is everything cached?</p>



<a name="215363642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215363642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215363642">(Nov 02 2020 at 19:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E/near/212478082">said</a>:</p>
<blockquote>
<p>cross-compilation with x.py build is unlikely to do what you want, it is semi-broken right now, see <a href="https://github.com/rust-lang/rust/issues/77352">https://github.com/rust-lang/rust/issues/77352</a></p>
</blockquote>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> is the one who suggest the dist library/std src/librustc line, because of an existing issue.  I can certainly take it off and rebuild</p>
<p>Anything I change has to be rebuilt from scratch, because of the whole OpenWrt thing (for instance, i use Ninja during the build, but I don't have it installed on my host machine.. it's only inside the build environment for openwrt)..  I'll just call <code>x.py dist</code> and see what it builds, before the <code>x.py install</code></p>



<a name="215368126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215368126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215368126">(Nov 02 2020 at 19:38)</a>:</h4>
<p>My build config, just as a refresher..</p>
<div class="codehilite"><pre><span></span><code>cd /home/grommish/openwrt/build_dir/hostpkg/rust-1.49.0 &amp;&amp; RUST_BACKTRACE=1 ./configure --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=mips64-unknown-linux-muslabi64sf --prefix=/home/grommish/openwrt/build_dir/hostpkg/.cargo --bindir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin --libdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/lib --sysconfdir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/etc --datadir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/share --localstatedir=/var --mandir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/man --infodir=/home/grommish/openwrt/build_dir/hostpkg/.cargo/info --release-channel=experimental --enable-debug --disable-docs --disable-compiler-docs --enable-parallel-compiler --enable-ccache --enable-llvm-link-shared --enable-option-checking --enable-ninja --enable-full-tools --enable-missing-tools --enable-manage-submodules --enable-full-bootstrap --set=target.mips64-unknown-linux-muslabi64sf.musl-root=/home/grommish/openwrt/staging_dir/toolchain-mips64_octeon3_64_gcc-10.2.0_musl
configure: processing command line
configure:
configure: build.build          := x86_64-unknown-linux-gnu
configure: build.host           := [&#39;x86_64-unknown-linux-gnu&#39;]
configure: build.target         := [&#39;mips64-unknown-linux-muslabi64sf&#39;]
configure: install.prefix       := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.bindir       := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.libdir       := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.sysconfdir   := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.datadir      := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.localstatedir := /var
configure: install.mandir       := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: install.infodir      := /home/grommish/openwrt/build_dir/hostpkg/.carg ...
configure: rust.channel         := experimental
configure: rust.debug           := True
configure: build.docs           := False
configure: build.compiler-docs  := False
configure: rust.parallel-compiler := True
configure: llvm.ccache          := True
configure: llvm.link-shared     := True
configure: llvm.ninja           := True
configure: rust.codegen-backends := [&#39;llvm&#39;]
configure: rust.lld             := True
configure: rust.llvm-tools      := True
configure: build.extended       := True
configure: dist.missing-tools   := True
configure: build.submodules     := True
configure: build.full-bootstrap := True
configure: target.mips64-unknown-linux-muslabi64sf.musl-root := /home/grommish/op ...
configure: build.configure-args := [&#39;--build=x86_64-unknown-linux-gnu&#39;, &#39;--host=x ...
configure:
configure: writing `config.toml` in current directory
configure:
configure: run `python /home/grommish/openwrt/build_dir/hostpkg/rust-1.49.0/x.py --help`
configure:
</code></pre></div>



<a name="215497141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215497141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215497141">(Nov 03 2020 at 19:02)</a>:</h4>
<p>Update: </p>
<p>I've tried it with both <code>x.py dist library/std src/librustc</code>, <code>x.py dist</code> and even just <code>x.py install</code>. </p>
<p>Dist gives me:</p>
<div class="codehilite"><pre><span></span><code>cargo-1.49.0-dev-x86_64-unknown-linux-gnu.tar.gz                rust-analyzer-1.49.0-dev-x86_64-unknown-linux-gnu.tar.gz
cargo-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz                rust-analyzer-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
clippy-1.49.0-dev-x86_64-unknown-linux-gnu.tar.gz               rustc-1.49.0-dev-x86_64-unknown-linux-gnu.tar.gz
clippy-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz               rustc-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
miri-1.49.0-dev-x86_64-unknown-linux-gnu.tar.gz                 rust-src-1.49.0-dev.tar.gz
miri-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz                 rust-src-1.49.0-dev.tar.xz
rust-analysis-1.49.0-dev-mips64-unknown-linux-muslabi64.tar.gz  rust-std-1.49.0-dev-mips64-unknown-linux-muslabi64.tar.gz
rust-analysis-1.49.0-dev-mips64-unknown-linux-muslabi64.tar.xz  rust-std-1.49.0-dev-mips64-unknown-linux-muslabi64.tar.xz
</code></pre></div>
<p>and I've run <code>./install.sh --prefix=/home/grommish/openwrt/build_dir/hostpkg/.cargo/ --verbose --disable-ldconfig</code> on the extracted contents of <code>rust-std-1.49.0-dev-mips64-unknown-linux-muslabi64.tar.gz</code></p>
<p>I still have the issue of:</p>
<div class="codehilite"><pre><span></span><code> CARGO_HOME=/home/grommish/openwrt/build_dir/hostpkg/.cargo ac_cv_path_CARGO=&quot;/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin/cargo&quot; ac_cv_path_RUSTC=&quot;/home/grommish/openwrt/build_dir/hostpkg/.cargo/bin/rustc&quot; RUSTFLAGS=&quot;-C linker=mips64-openwrt-linux-musl-gcc -C ar=mips64-openwrt-linux-musl-gcc-ar&quot; cargo install --force cbindgen --target mips64-unknown-linux-muslabi64
    Updating crates.io index
  Installing cbindgen v0.15.0
   Compiling proc-macro2 v1.0.24
   Compiling libc v0.2.80
   Compiling syn v1.0.48
   Compiling unicode-xid v0.2.1
   Compiling getrandom v0.1.15
   Compiling cfg-if v0.1.10
   Compiling serde_derive v1.0.117
   Compiling serde v1.0.117
   Compiling ryu v1.0.5
   Compiling ppv-lite86 v0.2.10
   Compiling autocfg v1.0.1
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `libc`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can&#39;t find crate for `std`

error[E0463]: can&#39;t find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can&#39;t find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: failed to compile `cbindgen v0.15.0`, intermediate artifacts can be found at `/tmp/cargo-install4mvm0Q`

Caused by:
  build failed
</code></pre></div>
<p>Any ideas?  This is the error the <code>x.py dist library/std src/librustc</code> was supposed to correct.</p>



<a name="215987165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987165">(Nov 08 2020 at 03:38)</a>:</h4>
<p>Question.  I've decided to take this step by step and seeing where my issues are.</p>
<p>I've compiled rustc/cargo for the host (<code>x86_64-unknown-linux-gnu</code>) with the following:<br>
<code>x.py --config ./config.toml dist cargo extended library/std llvm-tools miri rust-dev rustc-dev src src/librustc src/lldb_batchmode.py src/tools/build-manifest</code></p>
<p>I've then extracted all of the <code>build/dist</code> tarballs (<code>for file in *.xz; do tar -xvJf "$file"; done</code>) and then run <code>find ./* -type f -name install.sh -execdir sh {} --prefix=$(CARGO_HOME) \;</code> to install all of the created items (see below)</p>
<div class="codehilite"><pre><span></span><code>build-manifest-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz  rust-analyzer-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
cargo-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz           rustc-1.49.0-dev-src.tar.xz
clippy-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz          rustc-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
llvm-tools-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz      rustc-dev-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
miri-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz            rust-dev-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
rust-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz            rust-src-1.49.0-dev.tar.xz
rust-analysis-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz   rust-std-1.49.0-dev-x86_64-unknown-linux-gnu.tar.xz
</code></pre></div>
<p>So, the host has a ready to go compiled-from-source.</p>
<p>What do I need to do so that I can run rustc/cargo with a <code>--target mips64-unknown-linux-muslabl64</code> flag?</p>



<a name="215987297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987297">(Nov 08 2020 at 03:43)</a>:</h4>
<p>do you have the target installed?</p>



<a name="215987351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987351">(Nov 08 2020 at 03:45)</a>:</h4>
<p><code>rustup target add mips64-unknown-linux-muslabi64</code>?</p>



<a name="215987401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987401">(Nov 08 2020 at 03:46)</a>:</h4>
<p>I am not using <code>rustup</code>.  I cannot use rustup in this situation.  I also will need to use a custom defined triple (<code>mips64-unknown-linux-muslabi64sf</code>) which I've already patched the source for.</p>
<p>The host is the x86_64, the target is mips64.</p>



<a name="215987409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987409">(Nov 08 2020 at 03:47)</a>:</h4>
<p>oof well tbh I tl;dr'd that one <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="215987451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/215987451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#215987451">(Nov 08 2020 at 03:48)</a>:</h4>
<p>Understandable..  If you get bored you can scope the whole thing.. You might have insight<br>
Thanks for trying :)</p>



<a name="216173728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/216173728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#216173728">(Nov 10 2020 at 05:27)</a>:</h4>
<p>Ok!  Positive Update time!</p>
<p>I believe I've figured it out.  The issue I was having is that the default values in the config.toml were technically correct, but were not being used?  Probably because of how I was having to define everything (via ./configure flags).  I found that, by setting them, it made things like.. work..  Go figure :)</p>
<div class="codehilite"><pre><span></span><code>  --set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \
  --set=target.$(RUSTC_TARGET_ARCH).cc=$(TARGET_CC_NOCACHE) \
  --set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \
  --set=target.$(RUSTC_TARGET_ARCH).ar=$(TARGET_AR) \
  --set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB) \
  --set=target.$(RUSTC_TARGET_ARCH).crt-static=false
</code></pre></div>
<p>I believe I'm about there.. Now.. Question.. Is there a way to compile std AND host for a given triple?  Example, <code>mips64-unknown-linux-muslabi64</code> has <code>std</code> but not <code>host</code>.  Is there a way to compile for it since I'm generating a cross-compile environment that seems to be working now?</p>



<a name="216294345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/216294345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#216294345">(Nov 11 2020 at 00:36)</a>:</h4>
<p>It works!  I got it working..  I now have a mips64 soft-float, dynamically linked std and the proper host triple.. it cross compiles my suricata6 with the proper soft-float and linking!  thank you all!  And now, rustc/cargo can be integrated into openwrt</p>



<a name="216301417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/building%20rust/cargo%20from%20source%20for%20cross_compile%20mips64_.../near/216301417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Grommish <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/building.20rust.2Fcargo.20from.20source.20for.20cross_compile.20mips64_.2E.2E.2E.html#216301417">(Nov 11 2020 at 02:29)</a>:</h4>
<p>So, is there a way for me to create a mips64_muslabi64 suite of rustc/cargo?  Or is this something for down the line once mips64_muslabi64 is more "supported"?  If I have to create the toolchain environment , if I can, creating the development tools to put on the target device would be the next step I suppose?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>